var t = i(require("../../libs/mini/create")), e = i(require("../../store/index")), a = require("../../api/member");

function i(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var n = getApp();

t.default.Page(e.default, {
    use: [ "customLoading", "custom", "userInfo" ],
    data: {
        loading: !1,
        list: [],
        page: 1,
        finished: !1
    },
    onLoad: function(t) {
        var a = this;
        e.default.getCustom(function() {
            e.default.getUserInfo(function() {
                a.setData({
                    list: [],
                    finished: !1,
                    page: 1
                }), a._fetch();
            });
        });
    },
    _fetch: function() {
        var t = this;
        return new Promise(function(e, i) {
            if (t.data.loading || t.data.finished) return e([]);
            var s = t.data.$.userInfo.openid, o = t.data.page;
            t.setData({
                loading: !0
            }), (0, a.getDepositList)({
                member_openid: s,
                page: o
            }).then(function(a) {
                var i;
                a && a.length ? (i = t.data.list, t.setData({
                    list: i.concat(a),
                    loading: !1,
                    finished: !1,
                    page: o + 1
                })) : 1 == +o ? t.setData({
                    list: [],
                    finished: !0,
                    loading: !1,
                    page: o + 1
                }) : t.setData({
                    finished: !0,
                    loading: !1,
                    page: o + 1
                }), e(a);
            }).catch(function() {
                n.utils.toastText("服务器出错"), t.setData({
                    loading: !1
                }), i([]);
            });
        });
    },
    onReachBottom: function() {
        this._fetch();
    }
});